//2009/08/17 18:21:34
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class BalancedGame
{
public:
    int result(vector <string> conflicts, int p, int q)
    {
		int ret = -1;
		for(int i=0; i<conflicts.size(); i++)
		{
			int wins = 0;
			int fails = 0;
			for(int j=0; j<conflicts[i].size(); j++)
			{
				if(conflicts[i][j] == 'W') wins ++;
				else if(conflicts[i][j] == 'L') fails ++;
			}
			if(wins * 100 < p * (conflicts[i].size()-1) || fails * 100 < q * (conflicts[i].size() - 1))
				return i;
		}
		return ret;
    }
};
